package com.acwing.partition20;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/5/5 10:32
 */
public class AC1977信息中继 {

    private static final int N = 1010;
    private static int[] parent = new int[N], ne = new int[N];
    private static int n;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = nextInt();
        for (int i = 1; i <= n; i++) parent[i] = i;
        for (int i = 1; i <= n; i++) {
            ne[i] = nextInt();
            int fa = find(i), fb = find(ne[i]);
            if (ne[i] != 0) parent[fa] = fb;
        }
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            int fa = find(i);
            if (ne[fa] == 0) ans++;
        }
        writer.println(ans);
        writer.flush();
    }

    private static int find(int x) {
        if (x != parent[x]) parent[x] = find(parent[x]);
        return parent[x];
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
